package com.barradata.common.disposable

import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable

/**
 * Author:    WuNan
 * Email:     wunan@barradata.com
 * Created:   2019/7/23 15:54
 * Description:
 **/
interface IAutoDispose {
    fun compositeDisposable(): CompositeDisposable? = null

    fun Disposable.autoClean() {
        compositeDisposable()?.add(this)
    }

    fun disposeExt() {
        compositeDisposable()?.dispose()
    }
}